<!DOCTYPE html . "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <title></title>
    <!--载入编辑器-->
    <script type="text/javascript" charset="utf-8" src="./ueditor1_4_3/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="./ueditor1_4_3/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="./ueditor1_4_3/lang/zh-cn/zh-cn.js"></script>
    <!--载入uploadify相关文件-->
    <script type="text/javascript" src="{{asset('public/org/uploadify/jquery-1.8.2.min.js')}}"></script>
    <script type="text/javascript" src="{{asset('public/org/uploadify/jquery.uploadify.min.js')}}"></script>
    <link href="{{asset('public/org/uploadify/uploadify.css')}}" type="text/css" rel="stylesheet">
    <!--载入hdjs-->
    <link rel="stylesheet" type="text/css" href="{{asset('public/sytle/hdjs/hdjs.css')}}"/>
    <script src="{{asset('public/sytle/hdjs/hdjs.min.js')}}" type="text/javascript" charset="utf-8"></script>
    <style type="text/css">
        li{
            list-style: none;
            float: right;
        }
        tr{
            height: 30px;
        }
        input{
            height: 20px;
            font-size: 14px;
        }
    </style>
</head>
<body>

<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <form action="{{url('admin/car/'.$data->id)}}" method='post' enctype="multipart/form-data" id="add_goods">
                <input type="hidden" name="_method" value="put">
                {{csrf_field()}}
                <h2 class="hd-title-header" style="font-size: 20px;">编辑汽车</h2>
                @if(count($errors)>0)
                        @if(is_object($errors))
                            @foreach($errors->all() as $error)
                                <p style="color: red">{{$error}}</p>
                            @endforeach
                        @else
                            <p>{{$errors}}</p>
                        @endif
                @endif
                <table class='hd-table hd-table-form' style="border-top:1px solid #E5E5E5 ;">
                    <p class="hd-title-header">基本信息</p>
                    <tbody>
                    <tr class="info">
                        <td>所属车型</td>
                        <td>
                            <select name="zc_carModel_mid">
                                @foreach($carmodel as $v)
                                <option value="{{$v->mid}}"
                                    @if($v->mid == $data->zc_carModel_mid )
                                        selected
                                        @endif
                                >{{$v->mname}}</option>
                                    @endforeach

                            </select>
                        </td>
                    </tr>
                    <tr class="info">
                        <td>所属品牌</td>
                        <td>
                            <select name="zc_brand_bid">
                                <option value="0">-请选择-</option>
                                @foreach($brand as $b)
                                <option value="{{$b->bid}}"
                                        @if($b->bid == $data->zc_brand_bid )
                                        selected
                                        @endif
                                >{{$b->bname}}</option>
                                    @endforeach
                            </select>
                        </td>
                    </tr>
                    <tr class="info">
                        <td>所属门店</td>
                        <td>
                            <select name="zc_store_menid">
                                <option value="0">-请选择-</option>
                                @foreach($store as $v)
                                <option value="{{$v->menid}}"
                                        @if($v->menid == $data->zc_store_menid )
                                        selected
                                        @endif
                                >{{$v->mname}}</option>
                                    @endforeach
                            </select>
                        </td>
                    </tr>
                    <tr class="info">
                        <td>汽车名</td>
                        <td>
                            <input type="text" name='carname' value="{{$data->carname}}"/>
                        </td>
                    </tr>
                    <tr class="info">
                        <td>价格</td>
                        <td>
                            <input type="text" name='cprice' value="{{$data->cprice}}"/>
                        </td>
                    </tr>
                    <tr class="info">
                        <td>列表图</td>
                        <td>
                            <input id="file1" type="file" multiple="true" name="listView"/>
                            <span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>
                            <script type="text/javascript">
                                $(function() {
                                    $('#file1').uploadify({
                                        'formData'     : {//POST数据
                                            '<?php echo session_name();?>' : '<?php echo session_id();?>',
                                            '_token': "{{csrf_token()}}",
                                        },
                                        'fileTypeDesc' : '上传文件',//上传描述
                                        'fileTypeExts' : '*.jpg;*.png',
                                        'swf'      : '{{asset('public/org/uploadify/uploadify.swf')}}',
                                        'uploader' : "{{url('admin/car/upload')}}",
                                        'buttonText':'重新选择',
                                        'fileSizeLimit' : '2000KB',
                                        'uploadLimit' : 1000,//上传文件数
                                        'width':65,
                                        'height':25,
                                        'successTimeout':10,//等待服务器响应时间
                                        'removeTimeout' : 0.2,//成功显示时间
                                        'onUploadSuccess' : function(file, data, response) {
                                            $("#photo-list1").html('');
                                            var imageUrl = data?'/'+data:'/image/default.png';
                                            var li="<li  url='"+data+"'><img src='" +imageUrl+"' class='hd-w80 hd-h70'/>";
                                            li +='<input type="hidden" name="listView" value="'+data+'"/>';
                                            li +='</li>';
                                            $("#photo-list").prepend(li);
                                        }
                                    });
                                });
                            </script>
                        </td>
                        <td id='photo-list1'>
                            <li ><img src="/{{$data->listView}}" alt="" class='hd-w80 hd-h70'></li>
                            <input type="hidden" name="listView" value="{{$data->listView}}">
                        </td>
                        <td id='photo-list'>

                        </td>
                    </tr>
                    <tr class="info">
                        <td>是否热门</td>
                        <td>
                            <select name="hot">
                                <option value="0"
                                    @if($data->hot == 0)
                                        selected
                                        @endif
                                >是</option>

                                <option value="1"
                                        @if($data->hot == 1)
                                        selected
                                        @endif
                                >否</option>
                            </select>
                        </td>
                    </tr>
                    <tr class="info">
                        <td>库存</td>
                        <td>
                            <input type="text" name='count' value="{{$data->count}}"/>
                        </td>
                    </tr>
                    <tr class="info">
                        <td>车牌号</td>
                        <td>
                            <input type="text" name='carID' value="{{$data->carID}}"/>
                        </td>
                    </tr>
                    </tbody>
                </table>

                <table class='hd-table hd-table-form' style="border-top:1px solid #E5E5E5 ;">
                    <p class="hd-title-header">汽车配置信息</p>
                    <tbody>
                    <tr class="info">
                        <td>车门数量：<input type="text" name='cm' value="{{$data->cm}}"/></td>
                        <td>座位数：<input type="text" name='zw' value="{{$data->zw}}"/></td>
                        <td>燃油类型：<input type="text" name='rylx' value="{{$data->rylx}}"/></td>
                        <td>变数箱类型：<input type="text" name='bsx' value="{{$data->bsx}}"/></td>
                    </tr>
                    <tr class="info">
                        <td>排量：<input type="text" name='px' value="{{$data->px}}"/></td>
                        <td>燃油标号：<input type="text" name='rybh' value="{{$data->rybh}}"/></td>
                        <td>驱动方式：<input type="text" name='qdfs' value="{{$data->qdfs}}"/></td>
                        <td>发动机进气方式：<input type="text" name='fdjjq' value="{{$data->fdjjq}}"/></td>
                    </tr>
                    <tr class="info">
                        <td>
                            天窗：
                            <select name="tc">
                                <option value="0"
                                    @if($data->tc == 0)
                                        selected
                                        @endif
                                >无</option>

                                <option value="1"
                                        @if($data->tc == 1)
                                        selected
                                        @endif
                                >有</option>
                            </select>
                        </td>
                        <td>油箱容量：<input type="text" name='yxrl' value="{{$data->yxrl}}"/></td>
                        <td>音响：<input type="text" name='yx' value="{{$data->yx}}"/></td>
                        <td>座椅：<input type="text" name='zy' value="{{$data->zy}}"/></td>
                    </tr>
                    <tr class="info">
                        <td>
                            倒车雷达：
                            <select name="dcld">
                                <option value="0"
                                        @if($data->dcld == 0)
                                        selected
                                        @endif
                                >无</option>

                                <option value="1"
                                        @if($data->dcld == 1)
                                        selected
                                        @endif
                                >有</option>
                            </select>
                        </td>
                        <td>气囊：<input type="text" name='qn' value="{{$data->qn}}"/></td>
                        <td>
                            DVD/CD：
                            <select name="DvD">
                                <option value="DVD"
                                        @if($data->DvD == "DVD")
                                        selected
                                        @endif
                                >DVD</option>

                                <option value="CD"
                                        @if($data->DvD == "CD")
                                        selected
                                        @endif
                                >CD</option>
                            </select>
                        </td>
                        <td>
                            GPS:
                            <select name="GPS">
                                <option value="0"
                                        @if($data->GPS == 0)
                                        selected
                                        @endif
                                >无</option>

                                <option value="1"
                                        @if($data->GPS == 1)
                                        selected
                                        @endif
                                >有</option>
                            </select>
                        </td>
                    </tr>
                    </tbody>
                </table>

                <table class='hd-table hd-table-form' style="border-top:1px solid #E5E5E5 ;">
                    <p class="hd-title-header">汽车详情信息</p>
                    <tbody>
                        <tr class="info">
                            <td>汽车详情图</td>

                            <td>
                                <input id="file2" type="file" multiple="true" name="bigimg"/>
                                <span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>
                                <script type="text/javascript">
                                    $(function() {
                                        $('#file2').uploadify({
                                            'formData'     : {//POST数据
                                                '<?php echo session_name();?>' : '<?php echo session_id();?>',
                                                '_token': "{{csrf_token()}}",
                                            },
                                            'fileTypeDesc' : '上传文件',//上传描述
                                            'fileTypeExts' : '*.jpg;*.png',
                                            'swf'      : '{{asset('public/org/uploadify/uploadify.swf')}}',
                                            'uploader' : "{{url('admin/car/upload')}}",
                                            'buttonText':'重新上传',
                                            'fileSizeLimit' : '2000KB',
                                            'uploadLimit' : 1000,//上传文件数
                                            'width':65,
                                            'height':25,
                                            'successTimeout':10,//等待服务器响应时间
                                            'removeTimeout' : 0.2,//成功显示时间
                                            'onUploadSuccess' : function(file, data, response) {
                                                $("#carpic_list1").html('');
                                                var imageUrl = data?'/'+data:'/image/default.png';
                                                var li="<li  url='"+data+"'><img src='" +imageUrl+"' class='hd-w80 hd-h70'/>";
                                                li +='<input type="hidden" name="bigimg[]" value="'+data+'"/>';
                                                li +='</li>';
                                                $("#carpic_list").prepend(li);
                                            }
                                        });
                                    });
                                </script>
                                <td id="carpic_list1">
                                @foreach($data->bigimg as $vv)
                                <li><img src="/{{$vv}}" alt="" class='hd-w80 hd-h70'></li>
                                    <input type="hidden" name="bigimg[]" value="{{$vv}}">
                                    @endforeach
                                </td>

                            <td id="carpic_list"></td>
                            </td>
                        </tr>
                    </tbody>
                </table>

                <input type="submit" value="确认添加" class="hd-btn hd-btn-success" style="height: 40px;"/>
            </form>

        </div>
    </div>
</div>
</body>
</html>